package org.advanced.rpc;

import java.lang.reflect.Proxy;

/**
 * @author John.zhang
 * @version Id: RpcProxyClient, v 1.0 2020/12/14 18:35 ZhiYong Exp $
 */
public class RpcProxyClient {

    public <T> T clientProxy(final Class<T> interfaceClass, final String host, final int port) {
        return (T) Proxy.newProxyInstance(interfaceClass.getClassLoader()
                , new Class<?>[]{interfaceClass}, new RemoteInvocationHandler(host,port));
    }

}
